<!--
描述：人员管理-老师维护-新增组件
开发人：sunlf
开发日期：2017年8月17日
-->

<template lang="pug">
  kalix-dialog.user-add(bizKey="teacher" ref="kalixBizDialog" v-bind:form-model.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot")
      el-form-item.s-flex(label="教师类别" prop="beOnExternal" v-bind:label-width="labelWidth")
        el-switch(v-model="formModel.beOnExternal" active-text="转外聘" inactive-text="转在编" active-value=1 inactive-value=0)
      div.s-flex
        div.s-flex_item
          el-form-item(label="所在部门" prop="orgId" v-bind:label-width="labelWidth")
            kalix-tree2.inline(v-model="formModel.orgId" v-bind:treeDataURL="orgURL")
          el-form-item(v-if="formModel.beOnExternal === '0'" label="入校年份" prop="entranceYear" v-bind:label-width="labelWidth")
            kalix-date-picker(v-model="formModel.entranceYear" type="year")
          el-form-item(v-else label="启聘年份" prop="entranceYear" v-bind:label-width="labelWidth")
            kalix-date-picker(v-model="formModel.entranceYear" type="year")
          el-form-item(label="工号" prop="code" v-bind:label-width="labelWidth")
            el-input(v-model="formModel.code")
          el-form-item(label="姓名" prop="name" v-bind:label-width="labelWidth")
            el-input(v-model="formModel.name")
        div.s-flex_item
          el-form-item(label="照片" prop="icon" v-bind:label-width="labelWidth")
            kalix-upload(v-model="formModel.icon" v-bind:isImage="true" style="width:100%")
      div.s-flex
        el-form-item.s-flex_item(label="身份证号" prop="identificationCard" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.identificationCard")
        el-form-item.s-flex_item(label="性别" prop="sex" v-bind:label-width="labelWidth")
          kalix-dict-select(v-model="formModel.sex" appName="admin" dictType="性别")
      div.s-flex
        el-form-item.s-flex_item(label="出生日期" prop="birthday" v-bind:label-width="labelWidth")
          kalix-date-picker(v-model="formModel.birthday")
        el-form-item.s-flex_item(label="民族" prop="nation" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.nation")
      div.s-flex
        el-form-item.s-flex_item(label="籍贯" prop="placeOfOrigin" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.placeOfOrigin")
        el-form-item.s-flex_item(label="现住址" prop="address" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.address")
      div.s-flex
        el-form-item.s-flex_item(label="学历" prop="education" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.education")
        el-form-item.s-flex_item(label="学位" prop="degree" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.degree")
      div.s-flex
        el-form-item.s-flex_item(label="职称" prop="positionalTitles" v-bind:label-width="labelWidth")
          kalix-dict-select(v-model="formModel.positionalTitles" appName="admin" dictType="职称")
        el-form-item.s-flex_item(label="特殊身份" prop="specialIdentity" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.specialIdentity")
      div.s-flex
        el-form-item.s-flex_item(label="岗位" prop="position" v-bind:label-width="labelWidth")
          kalix-dict-select(v-model="formModel.position" appName="admin" dictType="岗位名称")
        el-form-item.s-flex_item(v-if="formModel.beOnExternal === '0'" label="是否在岗" prop="beOnDuty" v-bind:label-width="labelWidth")
          kalix-dict-select(v-model="formModel.beOnDuty" appName="admin" dictType="sf")
        el-form-item.s-flex_item(v-else label="是否聘任" prop="beOnDuty" v-bind:label-width="labelWidth")
          kalix-dict-select(v-model="formModel.beOnDuty" appName="admin" dictType="sf")
      div.s-flex
        el-form-item.s-flex_item(label="联系电话" prop="phone" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.phone")
        el-form-item.s-flex_item(label="手机" prop="mobile" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.mobile")
      el-form-item.s-flex(v-if="formModel.beOnExternal === '0'" label="电子邮件" prop="email" v-bind:label-width="labelWidth")
        el-input(v-model="formModel.email")
      div.s-flex(v-else)
        el-form-item.s-flex_item(label="电子邮件" prop="email" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.email")
        el-form-item.s-flex_item(label="所属单位" prop="originUnit" v-bind:label-width="labelWidth")
          el-input(v-model="formModel.originUnit")
      div.s-flex
        el-form-item.s-flex_item(label="个人简历" prop="resume" v-bind:label-width="labelWidth")
          el-input(type="textarea" v-model="formModel.resume")
        el-form-item.s-flex_item(label="个人说明" prop="introduction" v-bind:label-width="labelWidth")
          el-input(type="textarea" v-model="formModel.introduction")
      div.s-flex
        el-form-item.s-flex_item(label="学术研究" prop="learning" v-bind:label-width="labelWidth")
          el-input(type="textarea" v-model="formModel.learning")
        el-form-item.s-flex_item(label="教学情况" prop="teaching" v-bind:label-width="labelWidth")
          el-input(type="textarea" v-model="formModel.teaching")
      div.s-flex
        el-form-item.s-flex_item(label="擅长课程" prop="coursesSkills" v-bind:label-width="labelWidth")
          el-input(type="textarea" v-model="formModel.coursesSkills")
        el-form-item.s-flex_item(label="预备知识" prop="preliminary" v-bind:label-width="labelWidth")
          el-input(type="textarea" v-model="formModel.preliminary")
      el-form-item.s-flex(label="备注" prop="remark" v-bind:label-width="labelWidth")
        el-input(type="textarea" v-model="formModel.remark")
</template>

<script type="text/ecmascript-6">
  import FormModel from './model'
  import {orgURL, TeacherURL} from '../../config.toml'

  export default {
    name: 'AdminTeacherAdd',
    data() {
      return {
        formModel: Object.assign({}, FormModel),
        rules: {},
        targetURL: TeacherURL,
        orgURL: orgURL,
        labelWidth: '120px'
      }
    },
    components: {},
    created() {
    },
    methods: {
      /*
      onUserSelected(user) {
          this.formModel.sex = user.sex
          this.formModel.mobile = (user.mobile == null ? user.phone : user.mobile)
      }
      */
    }
  }
</script>

